package chapter_09_composite.typical;

/**
 * Created by CharloYao on 2017/3/6.
 * 客户端调用
 */
public class Client {

    public static void main(String[] args) {
        Company root = new CompositeCompany("总公司");
        root.add(new HrDepartment("总公司人力资源部"));
        root.add(new DevDepartment("总公司研发部"));

        Company shanghai = new CompositeCompany("上海分公司");
        shanghai.add(new HrDepartment("上海分公司人力资源部"));
        shanghai.add(new DevDepartment("上海分公司研发部"));

        Company pudong = new CompositeCompany("上海浦东分公司");
        pudong.add(new HrDepartment("上海浦东分公司人力资源部"));
        pudong.add(new DevDepartment("上海浦东分公司研发部"));
        shanghai.add(pudong);

        Company beijing = new CompositeCompany("北京分公司");
        beijing.add(new HrDepartment("北京分公司人力资源部"));
        beijing.add(new DevDepartment("北京分公司研发部"));

        root.add(shanghai);
        root.add(beijing);

        root.display(0);
    }

}
